{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "6875ece4-37ee-43fb-a146-d5239c6d94f4",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "bc3578f1-0869-423f-979c-e2efcfa6d301",
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "from matplotlib import patches\n",
    "import seaborn as sns\n",
    "import numpy as np\n",
    "import warnings\n",
    "import statsmodels.api as sm\n",
    "import statsmodels.formula.api as smf\n",
    "\n",
    "from statsmodels.stats.outliers_influence import variance_inflation_factor\n",
    "import sklearn\n",
    "from sklearn.impute import SimpleImputer"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "63ab92b4-ddf6-44d6-91ff-74bf1a467c36",
   "metadata": {},
   "source": [
    "方差膨胀因子（VIF）是衡量多元线性回归模型中多重共线性的一种度量。VIF的计算公式为:\n",
    "\n",
    "$VIF= \\frac{1}{1-R^2_i}$\n",
    "\n",
    "其中，$R_i$是自变量$X_i$对其余自变量作回归分析的负相关系数。VIF越大，自变量间存在多重共线性的可能性就越高。一般来说，如果VIF大于5，解释变量$X_i$就于其他变量存在高度的多重共线性，参数估计将出现较大的标准差。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "8ad18a99-5140-4e32-8cc9-909953725fd4",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Function that converts categorical values into numerical values via ordinal encoding or one-hot encoding\n",
    "from sklearn.preprocessing import OrdinalEncoder\n",
    "from sklearn.preprocessing import OneHotEncoder\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "# Function to split data into different groups\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.model_selection import cross_val_score\n",
    "from sklearn.model_selection import GridSearchCV\n",
    "from sklearn.feature_selection import VarianceThreshold\n",
    "# Statistics functions\n",
    "from scipy.stats import norm\n",
    "from scipy import stats\n",
    "from scipy.stats import chi2_contingency\n",
    "from scipy.stats import chi2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7b69a035-46cd-4a52-be5e-9ba8022f3490",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
